package com.as3.timbot.iso
{
	import flash.display.MovieClip;
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	import flash.events.Event;
	
	public class Tile extends EventDispatcher
	{
		private var __graphic:MovieClip;
		private var mycolumn:Number;
		private var myrow:Number;
		private var myx:Number;
		private var myy:Number;
		public static var HIT:String = "tile_hit";
		
		public function Tile()
		{
			__graphic = new SimpleTile();
			__graphic.addEventListener(MouseEvent.CLICK,onClick);
		}
		public function set column(value:Number)
		{
			mycolumn = value;
		}
		public function get column():Number
		{
			return mycolumn
		}
		public function set row(value:Number)
		{
			myrow = value;
		}
		public function get row():Number
		{
			return myrow;
		}
		public function set x(value:Number)
		{
			myx = value;
			__graphic.x = myx;
		}
		public function set y(value:Number)
		{
			myy = value;
			__graphic.y = myy;
		}
		public function getGraphic():MovieClip
		{
			return __graphic;
		}
		public function onClick(ev:MouseEvent):void
		{
			var myEvent:Event = new Event(Tile.HIT);
			dispatchEvent(myEvent);
		}
		public function setTerrain(value:String):void
		{
			__graphic.innerTile.gotoAndStop(value);
		}
	}
}